﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Nova_DAL;
using System.Data.Common;
using Nova_Common;
using System.Data;

public partial class Storage_Position : System.Web.UI.UserControl
{
    Nova_DAL.DbHelper access = new DbHelper();
    string strSQL = "";
    DbCommand cmd = null;
    DataSet ds = null;

    protected string _No_Lane = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ddlbind();
        }
    }

    protected void ddlbind()
    {
        strSQL = "SELECT No_Lane FROM TBase_Position WHERE No_Lane <>0 GROUP BY No_Lane ORDER BY No_Lane ";
        cmd = access.GetSqlStringCommond(strSQL);
        ds = access.ExecuteDataSet(cmd);
        if (ds.Tables[0].Rows.Count > 0)
        {
            ddlLane.DataSource = ds.Tables[0].DefaultView;
            ddlLane.DataBind();
            ddlLane.Items.Insert(0, new ListItem("选择巷道", "0"));
        }


        strSQL = "SELECT No_Line FROM TBase_Position WHERE No_Line <>0 GROUP BY No_Line  ORDER BY No_Line ";
        cmd = access.GetSqlStringCommond(strSQL);
        ds = access.ExecuteDataSet(cmd);
        if (ds.Tables[0].Rows.Count > 0)
        {
            ddlLine.DataSource = ds.Tables[0].DefaultView;
            ddlLine.DataBind();
            ddlLine.Items.Insert(0, new ListItem("选择排", "0"));
        }

        strSQL = "SELECT No_Col FROM TBase_Position WHERE No_Col <>0 GROUP BY No_Col ORDER BY No_Col ";
        cmd = access.GetSqlStringCommond(strSQL);
        ds = access.ExecuteDataSet(cmd);
        if (ds.Tables[0].Rows.Count > 0)
        {
            ddlCol.DataSource = ds.Tables[0].DefaultView;
            ddlCol.DataBind();
            ddlCol.Items.Insert(0, new ListItem("选择列", "0"));
        }

        strSQL = "SELECT No_Layer FROM TBase_Position WHERE No_Layer <>0 GROUP BY No_Layer ORDER BY No_Layer ";
        cmd = access.GetSqlStringCommond(strSQL);
        ds = access.ExecuteDataSet(cmd);
        if (ds.Tables[0].Rows.Count > 0)
        {
            ddlLayer.DataSource = ds.Tables[0].DefaultView;
            ddlLayer.DataBind();
            ddlLayer.Items.Insert(0, new ListItem("选择层", "0"));
        }
    }

    public string No_Lane
    {
        get
        {
            return ddlLane.SelectedValue;
        }
        set
        {
            ddlLane.SelectedValue = value;
        }
    }
    public string No_Line
    {
        get
        {
            return ddlLine.SelectedValue;
        }
        set
        {
            ddlLine.SelectedValue = value;
        }
    }

    public string No_Col
    {
        get
        {
            return ddlCol.SelectedValue;
        }
        set
        {
            ddlCol.SelectedValue = value;
        }
    }

    public string No_Layer
    {
        get
        {
            return ddlLayer.SelectedValue;
        }
        set
        {
            ddlLayer.SelectedValue = value;
        }
    }

}
